package dao;

import java.util.ArrayList;






import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;

import com.fragment.MainFragment;

import util.ApplicationConstant;





import dao.HttpPostThread;
import entities.Category;


import android.os.AsyncTask;
import android.os.Handler;
import android.view.View;


public class LoadCategory extends AsyncTask<String, Void, String>{
	public static final String CATEGORY_ID="id";
	public static final String CATEGORY_NAME="name";
	public static final String CATEGORY_ENG_NAME="engname";
	private static Handler handler;
	public LoadCategory(Handler handler){
		LoadCategory.handler=handler;
		
	}
	
	@Override
	protected void onPreExecute() {
		// TODO Auto-generated method stub
		super.onPreExecute();
		MainFragment.layoutLoading.setVisibility(View.VISIBLE);
		//if(!MainActivity.progressDialog.isShowing())
			//MainActivity.progressDialog.show();
	}
    @Override
    protected String doInBackground(String... urls) {
    	
	 ArrayList<NameValuePair> pairs = new ArrayList<NameValuePair>();
	 pairs.add(new BasicNameValuePair(ApplicationConstant.ACTION,ApplicationConstant.ACTION_GET_ALL_CATERORY));
	 HttpPostThread thread = new  HttpPostThread(ApplicationConstant.URL_CATEGORY,pairs,handler);
	 thread.run();
     //change flag
	// MainActivity.LOADED=true;
     return null;
    }
  }
